package com.ys.erp.entity.data.bean;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * @author lwj
 * @date 2023/4/27
 */

@Data
@TableName(value = "t_user_delivery")
public class UserDelivery {
    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 用户id
     */
    @TableField(value = "user_id")
    private Long userId;

    /**
     * 收货人
     */
    @TableField(value = "delivery_name")
    private String deliveryName;

    /**
     * 收货人手机号
     */
    @TableField(value = "delivery_phone")
    private String deliveryPhone;

    /**
     * 省
     */
    @TableField(value = "delivery_province")
    private String deliveryProvince;

    /**
     * 市
     */
    @TableField(value = "delivery_city")
    private String deliveryCity;

    /**
     * 区
     */
    @TableField(value = "delivery_district")
    private String deliveryDistrict;

    @TableField(value = "province_code")
    private String provinceCode;

    @TableField(value = "city_code")
    private String cityCode;

    @TableField(value = "district_code")
    private String districtCode;

    /**
     * 详细地址
     */
    @TableField(value = "addr_detail")
    private String addrDetail;

    /**
     * 是否默认地址0否1是
     */
    @TableField(value = "is_default")
    private Integer isDefault;

    @TableField(value = "version")
    @Version
    private Integer version;

    @TableField(value = "create_time")
    private LocalDateTime createTime;

    @TableField(value = "update_time", update = "now()")
    private LocalDateTime updateTime;


    public String getDeliveryInfo() {
        return this.deliveryName + " " + this.deliveryPhone + " \\n" + this.deliveryProvince + " " + this.deliveryCity + " " + this.deliveryDistrict + " " + this.addrDetail;
    }
}